﻿using ECO.Admin.Application.Controllers.Auth.Dtos.InputModels;
using ECO.Admin.Application.Controllers.Auth.Dtos.OutputDtos;
using ECO.Admin.Application.Controllers.Auth.Services;

namespace ECO.Admin.Application.Controllers.Auth
{
    /// <summary>
    /// 登录控制器
    /// </summary>
    [AllowAnonymous]
    public class AuthController : IDynamicApiController
    {
        private readonly IAuthService _authService;

        public AuthController(IAuthService systemService, IAuthService authService)
        {
            _authService = authService;
        }

        public async Task<LoginDto> Login(LoginInput loginInput)
        {
            if (loginInput.ValidCode != null)
            {
                //todo: 如果有验证码则校验
            }
            return await _authService.Login(loginInput);

        }

        public async Task<UserDto> Register(RegisterInput registerInput)
        {
            if (registerInput.ValidCode != null)
            {
                //todo: 如果有验证码则校验
            }
            return await _authService.Register(registerInput);
        }
    }
}